﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Globalization;
using System.Web.UI.WebControls;

namespace Axe.Web.Controls
{
    public class MonthDropDownList : HardcodedDropDownList
    {
        public MonthDropDownList()
        {
            ToolTip = Resources.Control_Resources.MonthDropDownList_ToolTip;
        }

        protected override HardcodedDropDownListEventArgs OnRequestDataItems()
        {
            HardcodedDropDownListEventArgs aeargs = new HardcodedDropDownListEventArgs();

            for (int i = 1; i <= 12; i++)
            {
                string monthName = Utility.GetMonthName(i, false);
                aeargs.BoundItems.Add(new ListItem(monthName, i.ToString()));
            }

            return aeargs;
        }

        #region public int SelectedMonth
        public int SelectedMonth
        {
            get
            {
                int month;
                if (int.TryParse(SelectedValue, out month))
                    return month;
                else
                    return 0;
            }
        } 
        #endregion
    }
}
